//    Copyright (C) Kherty.  All rights reserved.
using System;
using OpenLS.Core.Serialization;
using OpenLS.Drawing.Serialization;

namespace OpenLS.Drawing.Diagram.Serialization
{
    public class DiagramInstanceProvider: IOfficeInstanceProvider
    {
        /// <summary>
        /// Returns an instance from a context, null if unknown
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public IOfficeXmlSerializable ReadInstance(ReadContext context)
        {
            if (context.Reader.NamespaceURI == DiagramConstants.DiagramNamespaceUri)
            {
                if (context.ReaderLocalName == "relIds")
                {
                    return context.ReadElement<DiagramContainer>();
                }
            }
            return null;
        }
    }
}